package cool.webstudy.admin.exception;

import cool.webstudy.admin.constant.enums.rescode.BaseResCodeEnum;

/**
 * 
 * @author 莫振双
 * @date 2024/7/15 23:44
 * @description: 自定义系统异常
 */
public class SystemException extends RuntimeException implements BaseException{
    private BaseResCodeEnum resCodeEnum;
    /**
     * @description: 扩展消息数组，用于构造异常响应消息
     */
    private Object[] extendMessage;
    public SystemException(BaseResCodeEnum resCodeEnum) {
        this.resCodeEnum = resCodeEnum;
    }
    @Override
    public String getCode() {
        return resCodeEnum.code();
    }

    @Override
    public Object[] getExtendMessage() {
        return extendMessage;
    }

    @Override
    public String getMsg() {
        return resCodeEnum.msg();
    }

    @Override
    public BaseResCodeEnum getResCodeEnum() {
        return resCodeEnum;
    }
}
